home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NT Sources
/
Infomagic - NT Source Volume 1 (Disc 2 of 2).iso
/
utils
/
sdisetup.exe
/
sdi_js.txt
< prev
next >
Wrap
Text File
|
1998-05-31
|
2KB
|
104 lines
// This file contains a JavaScript object called SDI which contains
// functions to manipulate SDI using its automation interfaces. This
// file is only an example and does not implement everything SDI can
// do. The end of this file contains a very brief sample of using
// the SDI object. This sample was written and tested using
// Microsofts Windows Scripting Host which can be found at the
// following location: http://www.microsoft.com/scripting
function SDI()
{
this.objSDI = WScript.CreateObject("SDI32.Application");
this.ftpconnect=ftpconnect;
this.ftpput=ftpput;
this.ftpget=ftpget;
this.ftpbinary=ftpbinary;
this.ftpascii=ftpascii;
this.ftpdisconnect=ftpdisconnect;
this.displayerror=displayerror;
}
function ftpconnect(strServer,strUsername,strPassword)
{
if(this.objSDI.ftp("open",strServer)==false)
return false;
if(this.objSDI.ftp("username",strUsername)==false)
return false;
if(this.objSDI.ftp("password",strPassword)==false)
return false;
return true;
}
function ftpput(strLocalFile,strRemoteFile)
{
if(this.objSDI.ftp("remotepath",strRemoteFile)==false)
return false;
if(this.objSDI.ftp("put",strLocalFile)==false)
return false;
}
function ftpget(strRemoteFile,strLocalFile)
{
if(this.objSDI.ftp("localpath",strLocalFile)==false)
return false;
if(this.objSDI.ftp("get",strRemoteFile)==false)
return false;
return true;
}
function ftpbinary()
{
if(this.objSDI.ftp("binary","")==false)
return false;
else
return true;
}
function ftpascii()
{
if(this.objSDI.ftp("ascii","")==false)
return false;
else
return true;
}
function ftpdisconnect()
{
if(this.objSDI.ftp("close","")==false)
return false;
else
return true;
}
function displayerror()
{
var objShell = WScript.CreateObject("WScript.Shell");
objShell.Popup(this.objSDI.GetLastError());
}
// This is a brief sample of using the SDI object
var vSDI = new SDI();
if((vSDI.ftpconnect("ftp.testserver.com","anonymous","user@testserver.com"))==false)
vSDI.displayerror();
if((vSDI.ftpget("/index","c:\\temp\\index.txt"))==false)
vSDI.displayerror();
vSDI.ftpdisconnect();